﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LSBLL;
using LSEntity;
using LSInterFace;
using LSUtility;
using OralExamEntity;
using OralExamInterface;

namespace OralExamBLL
{
    public class OEControllerFormat<T, TResult> : IControllerFormat<TResult> where T : IOEControllerFormat<TResult>, new()
    {
        public string Area
        {
            get { return OEWebConfig.Area; }
        }

        public void Init(WebPageConfig webPageConfig, MemberEntity member)
        {

        }

        public TResult GetModel(WebPageConfig webPageConfig, MemberEntity member)
        {
            return new T().GetCommonModel(webPageConfig, member);
        }
    }

    public class OEStudentControllerFormatBLL : IOEControllerFormat<OEStudent.Common>
    {
        public OEStudent.Common GetCommonModel(WebPageConfig webPageConfig, MemberEntity member)
        {
            return new OEStudent.Common
                       {
                           Feet = new OEStudent.Feet(),
                           Head = new OEStudent.Head
                                    {
                                        UserName = member.RealName,
                                        Week = BaseTool.Week,
                                        LastLoginTime = member.LastLoginTM.ToString("yyyy年MM月dd日 HH:mm:ss"),
                                    },
                           LeftMenu = new OEStudent.LeftMenu
                                        {
                                            Area = webPageConfig.Area,
                                            LocalName = webPageConfig.LocalName,
                                        },
                           UserMessage = new OEStudent.UserMessage
                                           {
                                               LocalName = webPageConfig.LocalName,
                                               UserName = member.RealName,
                                               UserNum = member.Account,
                                           },
                       };
        }
    }

    public class OETeacherControllerFormatBLL : IOEControllerFormat<OETeacher.Common>
    {
        public OETeacher.Common GetCommonModel(WebPageConfig webPageConfig, MemberEntity member)
        {
            return new OETeacher.Common();
        }
    }

    public class OEControllerFormatBLL : IOEControllerFormat<OECommonNone>
    {
        public OECommonNone GetCommonModel(WebPageConfig webPageConfig, MemberEntity member)
        {
            return new OECommonNone();
        }
    }
}
